package collection_;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author 小闽
 * @Date 2024/10/28 8:27
 * @PackageName: collection_
 * @ClassName: ArrayListDetail
 * @Description: ArrayList细节
 * @Version 1.0
 */
@SuppressWarnings({"all"})
public class ArrayListDetail {
    public static void main(String[] args) {
        /**
         *    ArrayLsit是线程不安全的，可以看源码， 没有 synchronized
         *     public boolean add(E e) {
         *         ensureCapacityInternal(size + 1);  // Increments modCount!!
         *         elementData[size++] = e;
         *         return true;
         *     }
         */
        ArrayList list = new ArrayList();
        list.add("jack");
        list.add(null);
        list.add("tom");
        list.add(null);
        for (Object object : list) {
            System.out.println(object);
        }
    }
}
